<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
  <title>log_report (ServerMonitor::Monitor)</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
</head>
<body class="standalone-code">
  <pre><span class="ruby-comment cmt"># File ServerMonitor.rb, line 198</span>
                <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log_report</span>(<span class="ruby-identifier">filename</span>)
                        <span class="ruby-identifier">log</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">filename</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>,<span class="ruby-value str">&quot;r&quot;</span>).<span class="ruby-identifier">read</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>
                        <span class="ruby-identifier">out</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">filename</span>,<span class="ruby-value str">&quot;w&quot;</span>)
                        <span class="ruby-identifier">log</span> = <span class="ruby-value str">&quot;&quot;</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">log</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/xml version/i</span>)
                        <span class="ruby-identifier">doc</span> = <span class="ruby-constant">Document</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">log</span>
                        <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">log</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;&quot;</span>
                                <span class="ruby-identifier">doc</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">XMLDecl</span>.<span class="ruby-identifier">new</span>
                                <span class="ruby-identifier">docroot</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-value str">'ServerMonitor'</span>)
                                <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@xslt</span>
                                        <span class="ruby-identifier">xslt_text</span> = <span class="ruby-node">&quot;type=\&quot;text/xsl\&quot; href=\&quot;#{@xslt}\&quot;&quot;</span>
                                        <span class="ruby-identifier">xslt</span> = <span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;xml-stylesheet&quot;</span>, <span class="ruby-identifier">xslt_text</span>)
                                        <span class="ruby-identifier">root</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">root</span>
                                        <span class="ruby-identifier">root</span>.<span class="ruby-identifier">previous_sibling</span> = <span class="ruby-identifier">xslt</span>
                                <span class="ruby-keyword kw">end</span>
                        <span class="ruby-keyword kw">else</span>
                                <span class="ruby-identifier">docroot</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">elements</span>[<span class="ruby-value str">'ServerMonitor'</span>]
                        <span class="ruby-keyword kw">end</span>
                        <span class="ruby-identifier">docroot</span> = <span class="ruby-identifier">add_report_xml</span>(<span class="ruby-identifier">docroot</span>,<span class="ruby-identifier">servers</span>)
                        <span class="ruby-identifier">out</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">to_s</span>(<span class="ruby-value">0</span>)
                        <span class="ruby-keyword kw">ensure</span>
                                <span class="ruby-identifier">out</span>.<span class="ruby-identifier">close</span>
                <span class="ruby-keyword kw">end</span></pre>
</body>
</html>